﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace MyChart
{
    public class FxpDzBoard : ChartBase
    {
        string m_fxpDzBoardName = "名称";
        string m_fxpDzBoardStyle;
        string m_fxpDzBoardShiWaiDL = "室外电缆";
        string m_fxpDzBoardZuHe = "组合端子";

        int m_namex;
        int m_namey;
        int m_preDzRows;

        int m_nameRow;
        int m_nameCol;

        string m_style;

        public string Style
        {
            get { return m_style; }
            set { m_style = value; }
        }

        string m_fxpDzBoardId;

        public string FxpDzBoardId
        {
            get { return m_fxpDzBoardId; }
            set { m_fxpDzBoardId = value; }
        }
        PeiXianDz[] m_fxpDzs;

        public PeiXianDz[] FxpDzs
        {
            get { return m_fxpDzs; }
            set { m_fxpDzs = value; }
        }
        FxpChart m_paint;

        public FxpChart Paint
        {
            get { return m_paint; }
            set { m_paint = value; }
        }
        public FxpDzBoard()
        {
            m_fxpDzs = new PeiXianDz[6];
            for (int i = 0; i < 6; i++)
            {
                m_fxpDzs[i] = new PeiXianDz(i+1);
            }
        }
        public FxpDzBoard(string id)
        {
            m_fxpDzBoardId = id;
            m_fxpDzs = new PeiXianDz[6];
            for (int i = 0; i < 6; i++)
            {
                m_fxpDzs[i] = new PeiXianDz(i + 1);
            }
        }
        public FxpDzBoard(string id, int namex, int namey, int preDzRows, int namerow, int namecol)
        {
            m_fxpDzBoardId = id;
            m_namex = namex;
            m_namey = namey;
            m_preDzRows = preDzRows;
            m_nameRow = namerow;
            m_nameCol = namecol;
            m_fxpDzs = new PeiXianDz[6];
        }

        public override void InitChart(DataTable dt)
        {
            int r, c;
            m_style = dt.Rows[m_nameRow][m_nameCol + m_namex + 1].ToString();
            for (int i = 0; i < 6; i++)
            {
                r = m_nameRow + m_namey + i * m_preDzRows;
                c = m_nameCol + m_namex;
                PeiXianDz dz = new PeiXianDz(i + 1,r,c);
                dz.InitChart(dt);
                m_fxpDzs[i] = dz;
            }
        }
    }
}
